const db = require('../../../libs/db.config');

module.exports = async (data) => {
    // const searchSQL = `SELECT * FROM user WHERE userName = "${username}"`;
    const searchSQL = 'select commodity.content, commodity.images, commodity.title, commodity.pay, commodity.createTime,commodity.pID,user.userName from commodity inner join user on commodity.userID = user.userID WHERE commodity.title LIKE ?';
    let params = '%' + data + '%'
    return await db.query(searchSQL, [params]);
};
